<?php  
include 'codeBack.config.php';
include "connectMysql.php";
include "empty.php";
include 'header.php';
$user_id = $_POST['user_id'];
$token = $_POST['token'];
$user_name = $_POST["user_name"];
$id = $_POST["id"];
if(!$user_id || !$token || !$user_name ||!$id){
	exit();
}
$ac_user_sql = "SELECT * FROM ac_user WHERE user_id='$user_id' AND token='$token'";
$ac_user_result = $mysqli->query($ac_user_sql);
$ac_user_row = mysqli_fetch_object($ac_user_result);
if($ac_user_row->token == $token && $ac_user_row->user_id == $user_id){
	// 查找成功
	$ac_user_info_sql = "SELECT * FROM ac_user_info WHERE user_id='$user_id' AND id='$id'";
	$ac_user_info_result = $mysqli->query($ac_user_info_sql);
	$ac_user_info_row = mysqli_fetch_object($ac_user_info_result);
	if(count((array)$ac_user_info_row)){
		// 大于 0 表示插入成功
		// 插入成功
		$data = [
			"code"=>$CodeBack["EDITINFO_SUCCESS_CODE"],
			"user_id"=>$ac_user_row->user_id,
			"id"=>$id,
			"date"=>$ac_user_info_row->date,
			"morning"=>$ac_user_info_row->morning,
			"afternoon"=>$ac_user_info_row->afternoon,
			"evening"=>$ac_user_info_row->evening,
			"other"=>$ac_user_info_row->other,
		];
		echo json_encode($data);
	}else {
		$data = [
			"code"=>$CodeBack["EDITINFO_FAILED_CODE"],
			"message"=>"获取失败，请稍后再试",
		];
		echo json_encode($data);
	}
}